﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace HotelManager.Extensions
{
    public static class StringExtensions
    {
        public static string GetMD5(this string data)
        {
            if (string.IsNullOrWhiteSpace(data))
                throw new ArgumentNullException(nameof(data));
            var hash = new MD5CryptoServiceProvider().ComputeHash(Encoding.Default.GetBytes(data));
            return Convert.ToBase64String(hash);
        }
        public static string GetPassWord(this string data)
        {
            var temp= data.GetMD5().Split(' ').Reverse();
            var result=string.Join('-', temp);
            return result.GetMD5();
        }
    }
}
